package com.example.lilei.Loves;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.example.lilei.R;

public class LoveActivity extends AppCompatActivity {
    private EditText ed;
    private Button bt;
    private ImageView image;
    String reply;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_love);
        ed = (EditText) findViewById(R.id.love_ed);
        bt = (Button) findViewById(R.id.love_bt);
        image = (ImageView) findViewById(R.id.love_im);
        bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                reply = ed.getText().toString();
                if(reply.equals("爱")){
                    //Toast.makeText(LoveActivity.this, reply, Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(LoveActivity.this,Love_2Activity.class);
                    startActivity(intent);
                }else {
                    image.setImageResource(R.drawable.timgg);
                }
            }
        });
    }
}
